package com.atguigu.controller;

import com.atguigu.client.CartFeignClient;
import com.atguigu.client.OrderFeignClient;
import com.atguigu.client.ProductFeignClient;
import com.atguigu.entity.OrderInfo;
import com.atguigu.entity.SkuInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;


/**
   支付页面
 */
@Controller
public class WebPaymentController {
    @Autowired
    private OrderFeignClient orderFeignClient;
    //2.购物车列表
    //1.跳转到支付页面
    @RequestMapping("pay.html")
    public String pay(Long orderId, Model model){
        //获取订单信息
        OrderInfo orderInfo = orderFeignClient.getOrder(orderId);
        System.out.println(orderInfo);
        model.addAttribute("orderInfo",orderInfo);
        return "payment/pay";
    }
    //给用户展示成功支付的也页面
    @GetMapping("alipay/success.html")
    public String Success(){
        //修改订单状态,库存减少
       return "payment/success";
    }

}
